package com.kwq.designPattern.construct.director;

import java.io.*;

/**
 * @author kangwanqiang
 * @date 2021/2/7
 * @description 装饰器客户端
 */
public class DirectorClient {
    public static void main(String[] args) throws IOException {


        Car evCar = new EVCar("break your dream");
        evCar.drive();

        CarDirector fireEvCarDirector = new FireCarDirector(evCar);
        fireEvCarDirector.drive();

        CarDirector sexCarDirector = new SexCarDirector(evCar);
        sexCarDirector.drive();



        //jdk的读文件接口使用了装饰器模式
        File file = new File("/Users/kangwanqiang/Downloads/appenv");
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                new BufferedInputStream(new FileInputStream(file), 1024)));
        String tempString = reader.readLine();
        while (tempString != null) {
            System.out.println(tempString);
            tempString = reader.readLine();
        }
        reader.close();
    }
}
